package Java攻略._5_流式操作_lambda表达式与方法_引用的相关问题._1_java_util_Objects类;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class _1_返回集合与滤掉空元素 {

    public static void main(String[] args) {

        List<String> stringList = Arrays.asList("this", null, "is", null, "a", null, "list");

        List<String> collect = stringList.stream()
                .filter(Objects::nonNull)
                .collect(Collectors.toList());

        System.out.println(collect);
    }
}
